<?php
namespace Addons\Docs\Controller;

use Home\Controller\AddonsController;

class DocsController extends AddonsController
{

    function _initialize()
    {
        $act = strtolower(_ACTION);
        
        $res['title'] = '文档管理';
        $res['url'] = U('lists');
        $res['class'] = $act != 'server' ? 'current' : '';
        $nav[] = $res;
        
        $res['title'] = '小程序接口';
        $res['url'] = U('server');
        $res['class'] = $act == 'server' ? 'current' : '';
        $nav[] = $res;
        
        $this->assign('nav', $nav);
    }

    function lists()
    {
        $this->assign('add_button', false);
        parent::lists();
    }

    function server()
    {
        $url = addons_url("Docs://Export/lists");
        $url = str_replace('.html', '', $url);
        $this->assign('lists_url', $url);
        
        $url = addons_url("Docs://Export/upload");
        $url = str_replace('.html', '', $url);
        $this->assign('upload_url', $url);
        
        $url = addons_url("Docs://Export/download");
        $url = str_replace('.html', '', $url);
        $this->assign('download_url', $url);
        
        $this->display();
    }
}
